package P1000;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-10-07 12:45
 */
public class P1008_三连击 {
    public static void main(String[] args) {
        invoke();
    }

    private static void invoke(){
        StringBuilder sb = new StringBuilder();
        boolean[] flags = new boolean[10];
        dfs(sb,flags);
    }

    private static void dfs(StringBuilder sb,boolean[] flags) {
        if(sb.length() == 9){
            String now = sb.toString();
            int one = Integer.valueOf(now.substring(0,3));
            int two = Integer.valueOf(now.substring(3,6));
            int three = Integer.valueOf(now.substring(6,9));
            if(2*one == two && 3*one == three){
                System.out.printf("%d %d %d\n",one,two,three);
            }
            return ;
        }
        for(int i=1;i<10;++i){
            if(!flags[i]){
                flags[i] = true;
                sb.append(i);
                dfs(sb,flags);
                sb.deleteCharAt(sb.length()-1);
                flags[i] = false;
            }
        }
    }
}
